package meshGrammar;

public class Box3D {
public float x1,y1,z1,x2,y2,z2;
public void setEmpty(){
	x1=Float.POSITIVE_INFINITY;
	y1=Float.POSITIVE_INFINITY;
	z1=Float.POSITIVE_INFINITY;
	x2=Float.NEGATIVE_INFINITY;
	y2=Float.NEGATIVE_INFINITY;
	z2=Float.NEGATIVE_INFINITY;
}
public float getDimX(){
	return x2-x1;
}
public float getDimY(){
	return y2-y1;
}
public float getDimZ(){
	return z2-z1;
}

public float getCenterX(){
	return (x1+x2)*0.5f;
}
public float getCenterY(){
	return (y1+y2)*0.5f;
}
public float getCenterZ(){
	return (z1+z2)*0.5f;
}

public float getMaxDimension(){
	return Math.max(Math.max(getDimX(),getDimY()), getDimZ());
}
public void addPoint(float x,float y,float z){
	if (x<x1)x1=x;
	if (y<y1)y1=y;
	if (z<z1)z1=z;
	if (x>x2)x2=x;
	if (y>y2)y2=y;
	if (z>z2)z2=z;
}
@Override
public String toString() {
	// TODO Auto-generated method stub
	return "x1:"+x1+" y1:"+y1+" z1:"+z1+" dX:"+getDimX()+" dY:"+getDimY()+" dZ:"+getDimZ();
}
}
